package example_05;

import java.util.Arrays;

public class method_01 {
    /*创建一个方法对数组进行降序排序*/
    public static void main(String[] args) {
        int []a={1,2,3,4,56,8,9,7};
        sort1(a);
        System.out.println(Arrays.toString(a));
    }
    public static void sort1(int [] a){
        for (int i=0;i<a.length;i++){
            for (int j=i+1;j<a.length;j++){
                if (a[i]<a[j]){
                    a[i]+=a[j];
                    a[j]=a[i]-a[j];
                    a[i]=a[i]-a[j];
                }
            }
        }
    }
}
